package de.toolschmied.jjas.client.cms.actions;

import de.toolschmied.jjas.client.cms.actions.HeadingTypeAction.HeadingTypeListener;
import de.toolschmied.jjas.client.widgets.toolbar.Action;
import de.toolschmied.jjas.client.widgets.toolbar.Toolbar;

public class HeadingTypeToolbar extends Toolbar {

	public HeadingTypeToolbar(HeadingTypeListener listener) {
		for (HeadingType headingType : HeadingType.values()) {
			HeadingTypeAction action = new HeadingTypeAction(headingType, listener);
			add(action);
		}
	}
	
	public void setSelected(HeadingType type) {
		for (Action action : getActions()) {
			HeadingTypeAction headingTypeAction = (HeadingTypeAction) action;
			if (headingTypeAction.getHeadingType() == type) {
				setSelected(action);
				return;
			}
		}
	}
	
}
